<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // BigInt大整型
        let n = 521n;
        console.log(n, typeof (n));//521n 'bigint'

        // 函数
        let n1 = 123;
        console.log(BigInt(n));//521n
        // console.log(BigInt(1.2));//报错

        // 大数值运算
        let max = Number.MAX_SAFE_INTEGER;//9007199254740991 表示最大安全整数
        console.log(max+5);//5之后就不能再加了
        // 可以借助BigInt进行运算
        console.log(BigInt(max)+BigInt(5));//9007199254740996n
        console.log(BigInt(max)+BigInt(6));//9007199254740997n

    </script>
</body>

</html>